package com.qianfeng.chainmobile.api.mq;



import com.qianfeng.smsplatform.common.constants.RabbitMqConsants;
import com.qianfeng.smsplatform.common.model.Standard_Report;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;


@Component
public class ReportListener {

    private ApplicationContext context;


    @Autowired
    public void setContext(ApplicationContext context) {
        this.context = context;
    }

    @RabbitListener(queues = {RabbitMqConsants.TOPIC_PUSH_SMS_REPORT})
    public void onMessage(Standard_Report report) {
        System.err.println("收到的状态报告是:" + report);
        //通知客户
        context.publishEvent(report);
    }
}
